import request from '@/utils/request'
import type {
  TrademarkListType,
  UpdateTrademarkListType,
  TrademarkListRecordsType,
} from './model/trademarkModel'

enum Api {
  //获取品牌管理列表数据的接口
  getTrademarkListApi = `/admin/product/baseTrademark`,
  //添加品牌的接口
  addTrademarkListApi = `/admin/product/baseTrademark/save`,
  //删除品牌的接口
  delTrademarkListApi = `/admin/product/baseTrademark/remove`,
  //修改品牌的接口
  setTrademarkListApi = `/admin/product/baseTrademark/update`,
  //获取品牌管理单条list的接口
  findOneTrademarkListApi = `/admin/product/baseTrademark/get`,
}

//获取品牌管理数据的接口函数
export const ReqTrademarkList = (page: number, limit: number) => {
  return request.get<any, TrademarkListType>(
    `${Api.getTrademarkListApi}/${page}/${limit}`
  )
}

//添加品牌的接口函数
export const ReqAddTrademarkList = (data: UpdateTrademarkListType) => {
  return request.post<any, null>(`${Api.addTrademarkListApi}`, data)
}

//删除品牌的接口函数
export const ReqDelTrademarkList = (id: number) => {
  return request.delete<any, null>(`${Api.delTrademarkListApi}/${id}`)
}

//修改品牌的接口函数
export const ReqSetTrademarkList = (data: UpdateTrademarkListType) => {
  return request.put<any, null>(`${Api.setTrademarkListApi}`, data)
}

//获取品牌管理单条list数据的函数
export const ReqFindOneTrademark = (id: number) => {
  return request.get<any, TrademarkListRecordsType>(
    `${Api.findOneTrademarkListApi}/${id}`
  )
}
